<?php

require_once 'dataCenter.php';
require_once 'MJDMReward.php';
require_once "common.php";

log_action("In Page : ".__FILE__);

if(!isset($_SESSION)){session_start();}

$rewardlist = GetUserRewardsInfo()->Show();
// Printing tasklist
$rewardlist_outputs = "<ul class='rewards mt20'>\n";

foreach ($rewardlist as $reward) {
	$id = $reward->id;
	$reward_name = $reward->name;
	$reward_point =$reward->points;
	$reward_url = $reward->url;

	$rewardlist_outputs .="\t\t\t<li>\n";
	$rewardlist_outputs .="\t\t\t\t<p class='rewards-content'>\n";
	$rewardlist_outputs .="\t\t\t\t\t<span class='reward-name'>$reward_name</span>\n";
	if(strlen($reward_url)>0)
	{
		$rewardlist_outputs .="\t\t\t\t\t<a href='$reward_url' target='blank'>Link</a>\n";
	}
	$rewardlist_outputs .="\t\t\t\t</p>\n";
	$rewardlist_outputs .="\t\t\t\t<span class='coin'>$reward_point</span>\n";

	$rewardlist_outputs .="\t\t\t\t<div class='operation'>\n";
	$rewardlist_outputs .="\t\t\t\t\t<input type='button' value='delete' class='small red' />\n";
	$rewardlist_outputs .="\t\t\t\t\t<input type='button' value='edit' class='small blue' />\n";
	$rewardlist_outputs .="\t\t\t\t\t<input type='hidden' value='$id' class='hidden_id' />\n";
	$rewardlist_outputs .="\t\t\t\t</div>\n";
	$rewardlist_outputs .="\t\t\t</li>\n";
}
$rewardlist_outputs .= "\t\t</ul>\n";

echo $rewardlist_outputs;
